package main;

import java.util.HashMap;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

import Gui.GameplayState;
import Gui.MainMenuState;
import Gui.SetobjectsState;
import Objects.Body;
import Objects.BodyCircle;
import Objects.BodyRectangle;

public class Main extends StateBasedGame {

    public static final int MAINMENUSTATE          = 0;
    public static final int SETOBJECTSSTATE          = 1;
    public static final int GAMEPLAYSTATE          = 2;
    @SuppressWarnings("unchecked")
	public HashMap []hM;
	public HashMap<Integer, Body> bodies;
    public HashMap<Body, BodyRectangle> btr;
    public HashMap<Body, BodyCircle> btc;
    
    public Main(){
        super("Physim");
        hM=new HashMap[3];
        bodies=new HashMap<Integer, Body>();
        btr=new HashMap<Body, BodyRectangle>();
        btc=new HashMap<Body, BodyCircle>();
        hM[0]=bodies;
        hM[1]=btr;
        hM[2]=btc;
        this.addState(new MainMenuState(MAINMENUSTATE));
        this.addState(new SetobjectsState(SETOBJECTSSTATE, hM));
        this.addState(new GameplayState(GAMEPLAYSTATE, hM));
        this.enterState(MAINMENUSTATE);
    }
    
	public static void main(String[] args) { 
		try { 
			//AppGameContainer app = new AppGameContainer(new SimpleTest());
			AppGameContainer app = new AppGameContainer(new Main());
			app.setDisplayMode(800, 600, false);
			app.start(); 
		} 
		catch (SlickException e) {
			e.printStackTrace(); 
		} 
	} 
	
	public void initStatesList(GameContainer gameContainer) throws SlickException {
		 
        this.getState(MAINMENUSTATE).init(gameContainer, this);
        this.getState(SETOBJECTSSTATE).init(gameContainer, this);
        this.getState(GAMEPLAYSTATE).init(gameContainer, this);
    }

}
